package com.example.sjly.sqliteroom;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

@Dao
public interface UserDao {
    @Insert
    void insert(User user);

    @Query("SELECT * FROM users")
    List<User> getAll();

    @Query("SELECT * FROM users where username=:username and password=:password")
    List<User> Find(String username,String password);

    @Query("SELECT * FROM users where username=:userName")
    User getByName(String userName);

    @Update
    public void updateUsers(User user);


    @Delete
    public void deleteUsers(User user);
}
